﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using ClassLibrary;

namespace ControlNode
{
    class RoutingController
    {
        private ControlNode CNode;

        public RoutingController(ControlNode CNode)
        {
            this.CNode = CNode;
            PacketController.RC += new PacketController.PCEventHandler(QueryHandler);
        }

        public void QueryHandler(string message, Socket client)
        {
            string[] query = message.Split(' ');
            
            switch (query[0])
            {
                case "route_table_query":
                    CNode.WriteLine(String.Format("[--> RC] route_table_query({0} , {1})", query[1], query[2]));
                    CNode.WriteLine("[RC] Szukanie trasy...");
                    List<SNPP> answer = RouteTableQuery(query[1], query[2]);
                    CNode.WriteLine("[RC -->] Wysyłanie trasy...");
                    break;

                case "local_topology":

                    break;

                case "network_topology":

                    break;

                default:
                    break;
            }
        }

        public List<SNPP> RouteTableQuery(string name1, string name2)
        {
            return null;
        }

        public void LocalTopology()
        {

        }

        public void NetworkTopology()
        {

        }

    }
}
